<template>
  <div class="form-item">
    <span class="form-slider-slider">
      <a-slider
        v-model="formData[name]"
        :min="min"
        :max="max"
        :disabled="disabled"
      />
    </span>
    <span class="form-slider-input">
      <a-input-number
        v-model="formData[name]"
        :min="min"
        :max="max"
        :disabled="disabled"
        size="small"
        :style="{ width: '100%' }"
      />
    </span>
  </div>
</template>
<script lang="ts">
/**
 *
 */
import { Vue, Component, Prop } from 'vue-property-decorator'

@Component
export default class SliderWithInput extends Vue {
  @Prop() name!: any // key
  @Prop({ type: Boolean, default: false }) disabled!: boolean
  @Prop({ type: Object, default: () => ({}) }) formData!: { [key: string]: any }
  @Prop({ type: Number }) min!: number
  @Prop({ type: Number }) max!: number
  @Prop({ type: Number }) step!: number
}
</script>
<style lang="less" scoped>
.form-item {
  display: flex;
  justify-content: space-between;
  width: 100%;

  .form-slider-slider {
    display: inline-block;
    width: 73%;
  }

  .form-slider-input {
    display: inline-block;
    height: 100%;
    width: 25%;
  }
}
</style>
